﻿@{
    var resourceTypeDic = ResourceInfoManage.Instance.ResourceTypeDic;
    var resourceTypeIconDic = ResourceInfoManage.Instance.ResourceTypeIconDic;
    int? TypeCode = null;
    if (!string.IsNullOrEmpty(Convert.ToString(ViewData["TypeCode"])))
    {
        TypeCode = ViewData["TypeCode"] as int?;
    }
    string CourseId = null;
    if (!string.IsNullOrEmpty(Convert.ToString(ViewData["CourseId"])))
    {
        CourseId = ViewData["CourseId"].ToString();
    }
}
<div class="col-xs-2">
    <div class="dropdown theme-dropdown clearfix">
        <a id="dropdownMenu1" href="#" role="button" class="sr-only dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
        <ul id="resourceInfoList" class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
            @{
                var index = 0;
                foreach (var key in resourceTypeDic.Keys)
                {
                    string cssName = "";
                    if (TypeCode == key)
                    {
                        cssName = "active";
                    }
                    else if (TypeCode == null && index == 0)
                    {
                        cssName = "active";
                    }
                    
                <li class="@cssName" id="@key" role="presentation"><a role="menuitem" tabindex="-1" href="@Url.Action("ResourceInfoList","ResourceInfo")?TypeCode=@key&CourseId=@CourseId"><span class="glyphicon @resourceTypeIconDic[key]"></span> @resourceTypeDic[key]管理</a></li>
                <li role="presentation" class="divider"></li>
                <li role="presentation"><a role="menuitem" tabindex="-1" href="@Url.Action("ResourceInfoAdd","ResourceInfo")?TypeCode=@key&CourseId=@CourseId"><span class="glyphicon glyphicon-plus"></span> 新增<span>@resourceTypeDic[key]</span></a></li>
                    if (index != resourceTypeDic.Count() - 1)
                    {
                <li role="presentation" class="divider"></li>
                    }
                    index++;
                } 
            }
        </ul>
    </div>
</div>
